/**
 * Created by Richard Radlherr.
 * Date: 25.06.2006 02:41
 */
using System;
using System.Collections.Generic;
using CsGL;
using CsGL.OpenGL;
using TagTool.Core;
using TagTool.OpenGL;
using TagTool.GraphicTypes;

namespace TagTool.Nodes.Graphic
{

	public class TransformNode : BaseNode
	{
		private InputSlot shape;
		
		private InputSlot angle;
		private InputSlot rotate;
		private InputSlot translate;
		private InputSlot scale;

		public TransformNode()
		{
			Name = "Transform";
			angle = new InputSlot(this, "Angle", 0.0);
			rotate = new InputSlot(this, "Axis", new PointD(0.0, 1.0, 0.0));
			translate = new InputSlot(this, "Translate", new PointD());
			scale = new InputSlot(this, "Scale", new PointD(1.0, 1.0, 1.0));
			shape = new InputSlot(this, "Input Shape", new Shape());
			
			angle.ParseCallback = ParseHelper.ParseDouble;
			rotate.ParseCallback = ParseHelper.ParseVector;
			translate.ParseCallback = ParseHelper.ParseVector;
			scale.ParseCallback = ParseHelper.ParseVector;

		}
		
		public override void Update(Object sender)
		{
			((Shape)shape.Value).Angle = (double)angle.Value;
			((Shape)shape.Value).Translate = (PointD)translate.Value;
			((Shape)shape.Value).Rotate = (PointD)rotate.Value;
			((Shape)shape.Value).Scale = (PointD)scale.Value;
			CastTrigger();
		}
		
		[NodeAttribute(SlotType.Input, Show = true)]
		public InputSlot Angle
		{
			get { return angle; }
		}
		
		[NodeAttribute(SlotType.Input, Show = true)]
		public InputSlot Axis
		{
			get { return rotate; }
		}
		
		[NodeAttribute(SlotType.Input, Show = true)]
		public InputSlot Translate
		{
			get { return translate; }
		}
		
		[NodeAttribute(SlotType.Input, Show = true)]
		public InputSlot Scale
		{
			get { return scale; }
		}
		
		[NodeAttribute(SlotType.Input, Show = true)]
		public InputSlot Shape
		{
			get { return shape; }
		}

		
	}
}
